Low complexity sample adaptive offset (sao) coding

ABSTRACT

A device for encoding video data may be configured to encode video data according to a set of sample adaptive offset (SAO) types; perform a plurality of coding passes to test a subset of the SAO types for a first block of video data, wherein the subset is smaller than the set; select from the subset of SAO types an SAO type for the first block of video data; and generate for inclusion in an encoded bitstream, information for identifying the selected SAO type for the first block.

This Application claims the benefit of U.S. Provisional PatentApplication 62/129,628 filed Mar. 6, 2015, the entire content of whichis incorporated herein by reference.

TECHNICAL FIELD

This disclosure relates to video encoding and, more particularly, totechniques for sample adaptive offset (SAO) offset coding.

BACKGROUND

Digital video capabilities can be incorporated into a wide range ofdevices, including digital televisions, digital direct broadcastsystems, wireless broadcast systems, personal digital assistants (PDAs),laptop or desktop computers, tablet computers, e-book readers, digitalcameras, digital recording devices, digital media players, video gamingdevices, video game consoles, cellular or satellite radio telephones,so-called “smart phones,” video teleconferencing devices, videostreaming devices, and the like. Digital video devices implement videocompression techniques, such as those described in the standards definedby MPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264/MPEG-4, Part 10, AdvancedVideo Coding (AVC), the recently finalized ITU-T H.265, High EfficiencyVideo Coding (HEVC) standard, and the various HEVC extensions presentlyunder development. The video devices may transmit, receive, encode,decode, and/or store digital video information more efficiently byimplementing such video compression techniques.

Video compression techniques perform spatial (intra-picture) predictionand/or temporal (inter-picture) prediction to reduce or removeredundancy inherent in video sequences. For block-based video coding, avideo slice (i.e., a video frame or a portion of a video frame) may bepartitioned into video blocks, which may also be referred to astreeblocks, coding units (CUs) and/or coding nodes. Video blocks in anintra-coded (I) slice of a picture are encoded using spatial predictionwith respect to reference samples in neighboring blocks in the samepicture. Video blocks in an inter-coded (P or B) slice of a picture mayuse spatial prediction with respect to reference samples in neighboringblocks in the same picture or temporal prediction with respect toreference samples in other reference pictures. Pictures may be referredto as frames, and reference pictures may be referred to a referenceframes.

Spatial or temporal prediction results in a predictive block for a blockto be coded. Residual data represents pixel differences between theoriginal block to be coded and the predictive block. An inter-codedblock is encoded according to a motion vector that points to a block ofreference samples forming the predictive block, and the residual dataindicating the difference between the coded block and the predictiveblock. An intra-coded block is encoded according to an intra-coding modeand the residual data. For further compression, the residual data may betransformed from the pixel domain to a transform domain, resulting inresidual transform coefficients, which then may be quantized. Thequantized transform coefficients, initially arranged in atwo-dimensional array, may be scanned in order to produce aone-dimensional vector of transform coefficients, and entropy coding maybe applied to achieve even more compression.

SUMMARY

This disclosure describes techniques related to sample adaptive offset(SAO) filtering, and more particularly, this disclosure describestechniques for reducing complexity associated with deriving SAOinformation in a video encoding process.

In one example, a method of encoding video data includes encoding videodata according to a set of sample adaptive offset (SAO) types;performing a plurality of coding passes to test a subset of the SAOtypes for a first block of video data, wherein the subset is smallerthan the set; selecting from the subset of SAO types an SAO type for thefirst block of video data; and generating for inclusion in an encodedbitstream, information for identifying the selected SAO type for thefirst block.

In one example, a device for encoding video data includes a memoryconfigured to store video data and one or more processors configured toencode video data according to a set of sample adaptive offset (SAO)types; perform a plurality of coding passes to test a subset of the SAOtypes for a first block of video data, wherein the subset is smallerthan the set; select from the subset of SAO types an SAO type for thefirst block of video data; and generate for inclusion in an encodedbitstream, information for identifying the selected SAO type for thefirst block.

In another example, an apparatus for encoding video data includes meansfor encoding video data according to a set of sample adaptive offset(SAO) types; means for performing a plurality of coding passes to test asubset of the SAO types for a first block of video data, wherein thesubset is smaller than the set; means for selecting from the subset ofSAO types an SAO type for the first block of video data; and means forgenerating for inclusion in an encoded bitstream, information foridentifying the selected SAO type for the first block.

In another example, a computer readable storage medium storesinstructions that when executed by one or more processors cause the oneor more processors to encode video data according to a set of sampleadaptive offset (SAO) types; perform a plurality of coding passes totest a subset of the SAO types for a first block of video data, whereinthe subset is smaller than the set; select from the subset of SAO typesan SAO type for the first block of video data; and generate forinclusion in an encoded bitstream, information for identifying theselected SAO type for the first block.

The details of one or more examples of the disclosure are set forth inthe accompanying drawings and the description below. Other features,objects, and advantages will be apparent from the description, drawings,and claims.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating an example video encoding anddecoding system that may utilize the techniques described in thisdisclosure.

FIGS. 2A, 2B, 2C and 2D are conceptual diagrams illustrating exampleedge offset classifications for sample adaptive offset coding.

FIG. 3 is a conceptual diagram illustrating example band offsetclassifications for sample adaptive offset coding.

FIG. 4A is a block diagram illustrating an example video encoder thatmay implement the techniques described in this disclosure.

FIG. 4B is a block diagram illustrating an alternative view of anexample video encoder that may implement the techniques described inthis disclosure.

FIG. 5 is a block diagram illustrating an example video decoder that mayimplement the techniques described in this disclosure.

FIGS. 6-13 are flow diagrams illustrating technique for determining SAOinformation as part of a video encoding process.

DETAILED DESCRIPTION

This disclosure describes techniques related to sample adaptive offset(SAO) filtering, and more particularly, this disclosure describestechniques for reducing complexity associated with deriving SAOinformation in a video encoding process. As will be described in moredetail below, SAO information as used in this disclosure generallyrefers to one or both of an offset type and offset values. SAO filteringis a type of loop filtering used in video coding. In general, theaddition of offset values to pixels in a video frame (e.g., areconstructed image) may in some instances improve coding withoutgreatly increasing the bit overhead needed to store or transmit encodedvideo data. The improvement in coding that potentially results from SAOfiltering may be, for example, that a better rate-distortion (RD)tradeoff may be achieved when encoding the video data, and/or that adecoded video image contains less distortion relative to an originalvideo image for a given bit rate. SAO techniques allow for differentoffset values to be applied to different pixels (or blocks of pixels)depending on pixel (or block) classification metrics, such as edgemetrics, band metrics, or other types of metrics.

In some implementations, an SAO filter unit may be configured to performtwo types of SAO filtering, generally referred to in this disclosure asband offset filtering and edge offset filtering. An SAO filter unit mayalso at times apply no offset, which as will be explained in more detailbelow, can itself be considered a third type of SAO filtering. The typeof offset filtering applied by an SAO filter may be either explicitly orimplicitly signaled to a video decoder. When applying edge offsetfiltering, pixels can be classified based on edge information of acoding unit, and an offset can be determined for pixels based on theedge classification. As will be explained in greater detail below, thereare typically four variations of edge-based SAO, where the value of apixel is compared to two of the pixel's eight neighboring pixels. Whichtwo pixels are used for comparison depends on which variation ofedge-based offset is used. Based on the magnitude difference of thepixel relative to the neighboring pixels, an offset is added to thepixel value.

When applying band offset filtering, pixels can be classified intodifferent bands based on a pixel value, such as an intensity value, witheach band having an associated offset. A band includes a range of pixelvalues. For example, pixel values ranging from 0 to 255 may be dividedinto 32 equal bands (labeled 0 to 31), such that pixel values 0-7 are afirst band, pixel values 8-15 are a second band, pixel values 16-23 area third band, and so on for all thirty-two bands. The bands can be usedfor determining which particular offset value, of a plurality ofdifferent offset values, to apply to a pixel or group of pixels. Forexample, if a pixel has a value of 10 (which is within the second band,i.e. values 8-15, in the example above), then an offset associated withthe second band can be added to the pixel value.

For purposes of signaling and generating the offsets for the variousbands, the bands may be grouped into two or more groups. For band offsetfiltering, pixels may, for example, be categorized into thirty-two bands(bands 0-31) as described above, and the bands may be grouped into twogroups (e.g., two groups of sixteen bands, one group of four bands andone group of twenty-eight bands, one group of eight bands and one groupof twenty-four bands, or other such groupings). The groupings of bandscan be used for determining the order in which the offset values for thebands are signaled in the encoded video bitstream, and/or can be used todetermine if a particular band has an offset value other than zero.Offsets for the bands may be signaled using differential codingtechniques in which a current value is signaled as a difference betweenthe current value and a previous value. In order to reduce signalingoverhead, only a small number of bands (e.g. four bands) may beassociated with non-zero offset values, while all other bands areassumed to have an offset value of zero.

As implemented in the High Efficiency Video Coding (HEVC) standard, SAOfiltering may be enabled and disabled at the slice level, andfurthermore, SAO filtering may be enabled and disabled separately forluma and chroma samples. For example, for a particular slice of videodata, both luma and chroma samples may be SAO filtered; neither luma norchroma samples may be SAO filtered; or one of luma and chroma samplesmay be SAO filtered while the other is not. When SAO filtering isenabled for a slice, then SAO type and offset values are signaled at alargest coding unit (LCU) level. As introduced above, the SAO type caninclude band offset filtering, edge offset filtering, or no SAOfiltering. Thus, even if SAO filtering is enabled for a particularslice, some LCUs of that slice may not be SAO filtered (i.e. some LCUswill have an SAO type of no SAO filtering). In some instances, the SAOtype and the offset values may be signaled with a series of merge flags,where a true value for a first merge flag indicates the offset type andthe offset values for the LCU are inherited from a left neighboring LCU,and a true value for a second merge flag indicates the SAO type and theoffset values are inherited from an above neighboring LCU. If both mergeflags are false, then a new SAO type and new offset values are sent forthe LCU.

It should be understood that although HEVC enables and disables SAOfiltering at a slice level and signals SAO information at an LCU level,it is contemplated that the techniques of this disclosure may beimplemented in SAO configurations where such signaling occurs at adifferent level or in SAO configurations that use different signalingmechanisms altogether.

SAO information (e.g. an SAO type and a plurality of offset values) issignaled for an LCU. Based on the SAO type, a video decoder determineson a pixel-by-pixel basis which offset value from the plurality ofoffset values to add for each pixel. As will be explained in greaterdetail below, the determination of which offset value to apply for aparticular pixel or block of pixels (e.g. a 2×2 block in the LCU) may bedetermined based on the edge and band classifications determined for theparticular pixel of block of pixels.

As mentioned above, the addition of offset values to pixels in a videoframe may improve the quality of reconstructed video quality withoutgreatly increasing the bit overhead needed to store or transmit encodedvideo data. SAO may, however, greatly increase video encoder complexity.A video encoder determines how to encode a particular portion of videodata by performing multiple coding passes, with each coding passutilizing different coding tools (e.g. predictive modes, transformmodes, filters) or utilizing the same coding tools but with differentparameters. As used in this disclosure, a coding pass generally refersto either fully or partially encoding a portion of video data with acertain set of coding tools and parameters in order to test (e.g.analyze the achieved RD tradeoff for) those coding tools and parameters.Based on the multiple coding passes, the video encoder determines a setof coding tools and coding parameters that provide a desirable RDtradeoff. As SAO includes multiple SAO types, each of which can beimplemented with multiple offset values, a video encoder may have toengage in computationally complex processing to determine which SAO typeand which offset values to use for a particular block of video. Thisdisclosure introduces techniques that may potentially reduce thecomplexity of determining SAO information.

In describing various techniques, this disclosure may use terms such asfirst, second, third, etc. to differentiate between blocks, pixels, SAOinformation, etc. Unless stated to the contrary, such terms should notbe assumed to imply ordinal relationship, temporal relationship, orother such relationship. Instead, such terms are merely labels used todifferentiate different blocks, pixels, SAO information, etc.

FIG. 1 is a block diagram illustrating an example video encoding anddecoding system 10 that may utilize the SAO encoding techniquesdescribed in this disclosure. As shown in FIG. 1, system 10 includes asource device 12 that generates encoded video data to be decoded at alater time by a destination device 14, and as will be described in moredetail below, this encoding and decoding of video data may includecoding offset values for use in SAO filtering. Source device 12 anddestination device 14 may comprise any of a wide range of devices,including desktop computers, notebook (i.e., laptop) computers, tabletcomputers, set-top boxes, telephone handsets such as so-called “smart”phones, so-called “smart” pads, televisions, cameras, display devices,digital media players, video gaming consoles, video streaming device, orthe like. In some cases, source device 12 and destination device 14 maybe equipped for wireless communication.

Destination device 14 may receive the encoded video data to be decodedvia a link 16. Link 16 may comprise any type of medium or device capableof moving the encoded video data from source device 12 to destinationdevice 14. In one example, link 16 may comprise a communication mediumto enable source device 12 to transmit encoded video data directly todestination device 14 in real-time. The encoded video data may bemodulated according to a communication standard, such as a wirelesscommunication protocol, and transmitted to destination device 14. Thecommunication medium may comprise any wireless or wired communicationmedium, such as a radio frequency (RF) spectrum or one or more physicaltransmission lines. The communication medium may form part of apacket-based network, such as a local area network, a wide-area network,or a global network such as the Internet. The communication medium mayinclude routers, switches, base stations, or any other equipment thatmay be useful to facilitate communication from source device 12 todestination device 14.

Alternatively, encoded data may be output from output interface 22 to astorage device 19. Similarly, encoded data may be accessed from storagedevice 19 by input interface. Storage device 19 may include any of avariety of distributed or locally accessed data storage media such as ahard drive, Blu-ray discs, DVDs, CD-ROMs, flash memory, volatile ornon-volatile memory, or any other suitable digital storage media forstoring encoded video data. In a further example, storage device 19 maycorrespond to a file server or another intermediate storage device thatmay hold the encoded video generated by source device 12. Destinationdevice 14 may access stored video data from storage device 19 viastreaming or download. The file server may be any type of server capableof storing encoded video data and transmitting that encoded video datato the destination device 14. Example file servers include a web server(e.g., for a website), an FTP server, network attached storage (NAS)devices, or a local disk drive. Destination device 14 may access theencoded video data through any standard data connection, including anInternet connection. This may include a wireless channel (e.g., a Wi-Ficonnection), a wired connection (e.g., DSL, cable modem, etc.), or acombination of both that is suitable for accessing encoded video datastored on a file server. The transmission of encoded video data fromstorage device 19 may be a streaming transmission, a downloadtransmission, or a combination of both.

The techniques of this disclosure are not necessarily limited towireless applications or settings. The techniques may be applied tovideo coding in support of any of a variety of multimedia applications,such as over-the-air television broadcasts, cable televisiontransmissions, satellite television transmissions, streaming videotransmissions, e.g., via the Internet, encoding of digital video forstorage on a data storage medium, decoding of digital video stored on adata storage medium, or other applications. In some examples, system 10may be configured to support one-way or two-way video transmission tosupport applications such as video streaming, video playback, videobroadcasting, and/or video telephony.

In the example of FIG. 1, source device 12 includes a video source 18,video encoder 20 and an output interface 22. In some cases, outputinterface 22 may include a modulator/demodulator (modem) and/or atransmitter. In source device 12, video source 18 may include a sourcesuch as a video capture device, e.g., a video camera, a video archivecontaining previously captured video, a video feed interface to receivevideo from a video content provider, and/or a computer graphics systemfor generating computer graphics data as the source video, or acombination of such sources. As one example, if video source 18 is avideo camera, source device 12 and destination device 14 may formso-called camera phones or video phones. However, the techniquesdescribed in this disclosure may be applicable to video coding ingeneral, and may be applied to wireless and/or wired applications.

The captured, pre-captured, or computer-generated video may be encodedby video encoder 20. The encoded video data may be transmitted directlyto destination device 14 via output interface 22 of source device 12.The encoded video data may also (or alternatively) be stored ontostorage device 19 for later access by destination device 14 or otherdevices, for decoding and/or playback.

Destination device 14 includes an input interface 28, a video decoder30, and a display device 32. In some cases, input interface 28 mayinclude a receiver and/or a modem. Input interface 28 of destinationdevice 14 receives the encoded video data over link 16. The encodedvideo data communicated over link 16, or provided on storage device 19,may include a variety of syntax elements generated by video encoder 20for use by a video decoder, such as video decoder 30, in decoding thevideo data. Such syntax elements may be included with the encoded videodata transmitted on a communication medium, stored on a storage medium,or stored a file server.

Display device 32 may be integrated with, or external to, destinationdevice 14. In some examples, destination device 14 may include anintegrated display device and also be configured to interface with anexternal display device. In other examples, destination device 14 may bea display device. In general, display device 32 displays the decodedvideo data to a user, and may comprise any of a variety of displaydevices such as a liquid crystal display (LCD), a plasma display, anorganic light emitting diode (OLED) display, or another type of displaydevice.

Video encoder 20 and video decoder 30 may operate according to a videocompression standard, such as the recently finalized HEVC standard (andvarious extensions thereof presently under development). Alternatively,video encoder 20 and video decoder 30 may operate according to otherproprietary or industry standards, such as the ITU-T H.264 standard,alternatively referred to as MPEG-4, Part 10, Advanced Video Coding(AVC), or extensions of such standards. The techniques of thisdisclosure, however, are not limited to any particular coding standard.Other examples of video compression standards include MPEG-2 and ITU-TH.263.

Although not shown in FIG. 1, in some aspects, video encoder 20 andvideo decoder 30 may each be integrated with an audio encoder anddecoder, and may include appropriate MUX-DEMUX units, or other hardwareand software, to handle encoding of both audio and video in a commondata stream or separate data streams. If applicable, in some examples,MUX-DEMUX units may conform to the ITU H.223 multiplexer protocol, orother protocols such as the user datagram protocol (UDP).

Video encoder 20 and video decoder 30 each may be implemented as any ofa variety of suitable encoder circuitry, such as one or more integratedcircuits including microprocessors, digital signal processors (DSPs),application specific integrated circuits (ASICs), field programmablegate arrays (FPGAs), discrete logic, software, hardware, firmware, orany combinations thereof. When the techniques are implemented partiallyin software, a device may store instructions for the software in asuitable, non-transitory computer-readable medium and execute theinstructions in hardware such as integrated circuitry using one or moreprocessors to perform the techniques of this disclosure. Each of videoencoder 20 and video decoder 30 may be included in one or more encodersor decoders, either of which may be integrated as part of a combinedencoder/decoder (CODEC) in a respective device.

As introduced above, the JCT-VC has recently finalized development ofthe HEVC standard. The HEVC standardization efforts were based on anevolving model of a video coding device referred to as the HEVC TestModel (HM). The HM presumes several additional capabilities of videocoding devices relative to existing devices according to, e.g., ITU-TH.264/AVC. For example, whereas H.264 provides nine intra-predictionencoding modes, the HM may provide as many as thirty-fiveintra-prediction encoding modes.

In HEVC and other video coding specifications, a video sequencetypically includes a series of pictures. Pictures may also be referredto as “frames.” A picture may include three sample arrays, denoted SL,Scb, and Scr. SL is a two-dimensional array (i.e., a block) of lumasamples. Scb is a two-dimensional array of Cb chrominance samples. Scris a two-dimensional array of Cr chrominance samples. Chrominancesamples may also be referred to herein as “chroma” samples. In otherinstances, a picture may be monochrome and may only include an array ofluma samples.

To generate an encoded representation of a picture, video encoder 20 maygenerate a set of coding tree units (CTUs). Each of the CTUs maycomprise a coding tree block of luma samples, two corresponding codingtree blocks of chroma samples, and syntax structures used to code thesamples of the coding tree blocks. In monochrome pictures or pictureshaving three separate color planes, a CTU may comprise a single codingtree block and syntax structures used to code the samples of the codingtree block. A coding tree block may be an N×N block of samples. A CTUmay also be referred to as a “tree block” or a LCU. The CTUs of HEVC maybe broadly analogous to the macroblocks of other standards, such asH.264/AVC. However, a CTU is not necessarily limited to a particularsize and may include one or more coding units (CUs). A slice may includean integer number of CTUs ordered consecutively in a raster scan order.

To generate a coded CTU, video encoder 20 may recursively performquad-tree partitioning on the coding tree blocks of a CTU to divide thecoding tree blocks into coding blocks, hence the name “coding treeunits.” A coding block may be an N×N block of samples. A CU may comprisea coding block of luma samples and two corresponding coding blocks ofchroma samples of a picture that has a luma sample array, a Cb samplearray, and a Cr sample array, and syntax structures used to code thesamples of the coding blocks. In monochrome pictures or pictures havingthree separate color planes, a CU may comprise a single coding block andsyntax structures used to code the samples of the coding block.

Video encoder 20 may partition a coding block of a CU into one or moreprediction blocks. A prediction block is a rectangular (i.e., square ornon-square) block of samples on which the same prediction is applied. Aprediction unit (PU) of a CU may comprise a prediction block of lumasamples, two corresponding prediction blocks of chroma samples, andsyntax structures used to predict the prediction blocks. In monochromepictures or pictures having three separate color planes, a PU maycomprise a single prediction block and syntax structures used to predictthe prediction block. Video encoder 20 may generate predictive luma, Cb,and Cr blocks for luma, Cb, and Cr prediction blocks of each PU of theCU.

Video encoder 20 may use intra prediction or inter prediction togenerate the predictive blocks for a PU. If video encoder 20 uses intraprediction to generate the predictive blocks of a PU, video encoder 20may generate the predictive blocks of the PU based on decoded samples ofthe picture associated with the PU. If video encoder 20 uses interprediction to generate the predictive blocks of a PU, video encoder 20may generate the predictive blocks of the PU based on decoded samples ofone or more pictures other than the picture associated with the PU.

After video encoder 20 generates predictive luma, Cb, and Cr blocks forone or more PUs of a CU, video encoder 20 may generate a luma residualblock for the CU. Each sample in the CU's luma residual block indicatesa difference between a luma sample in one of the CU's predictive lumablocks and a corresponding sample in the CU's original luma codingblock. In addition, video encoder 20 may generate a Cb residual blockfor the CU. Each sample in the CU's Cb residual block may indicate adifference between a Cb sample in one of the CU's predictive Cb blocksand a corresponding sample in the CU's original Cb coding block. Videoencoder 20 may also generate a Cr residual block for the CU. Each samplein the CU's Cr residual block may indicate a difference between a Crsample in one of the CU's predictive Cr blocks and a correspondingsample in the CU's original Cr coding block.

Furthermore, video encoder 20 may use quad-tree partitioning todecompose the luma, Cb, and Cr residual blocks of a CU into one or moreluma, Cb, and Cr transform blocks. A transform block is a rectangular(e.g., square or non-square) block of samples on which the sametransform is applied. A transform unit (TU) of a CU may comprise atransform block of luma samples, two corresponding transform blocks ofchroma samples, and syntax structures used to transform the transformblock samples. Thus, each TU of a CU may be associated with a lumatransform block, a Cb transform block, and a Cr transform block. Theluma transform block associated with the TU may be a sub-block of theCU's luma residual block. The Cb transform block may be a sub-block ofthe CU's Cb residual block. The Cr transform block may be a sub-block ofthe CU's Cr residual block. In monochrome pictures or pictures havingthree separate color planes, a TU may comprise a single transform blockand syntax structures used to transform the samples of the transformblock.

Video encoder 20 may apply one or more transforms to a luma transformblock of a TU to generate a luma coefficient block for the TU. Acoefficient block may be a two-dimensional array of transformcoefficients. A transform coefficient may be a scalar quantity. Videoencoder 20 may apply one or more transforms to a Cb transform block of aTU to generate a Cb coefficient block for the TU. Video encoder 20 mayapply one or more transforms to a Cr transform block of a TU to generatea Cr coefficient block for the TU.

After generating a coefficient block (e.g., a luma coefficient block, aCb coefficient block or a Cr coefficient block), video encoder 20 mayquantize the coefficient block. Quantization generally refers to aprocess in which transform coefficients are quantized to possibly reducethe amount of data used to represent the transform coefficients,providing further compression. After video encoder 20 quantizes acoefficient block, video encoder 20 may entropy encode syntax elementsindicating the quantized transform coefficients. For example, videoencoder 20 may perform Context-Adaptive Binary Arithmetic Coding (CABAC)on the syntax elements indicating the quantized transform coefficients.

Video encoder 20 may output a bitstream that includes a sequence of bitsthat forms a representation of coded pictures and associated data. Thebitstream may comprise a sequence of NAL units. A NAL unit is a syntaxstructure containing an indication of the type of data in the NAL unitand bytes containing that data in the form of a RB SP interspersed asnecessary with emulation prevention bits. Each of the NAL units includesa NAL unit header and encapsulates a RBSP. The NAL unit header mayinclude a syntax element that indicates a NAL unit type code. The NALunit type code specified by the NAL unit header of a NAL unit indicatesthe type of the NAL unit. A RB SP may be a syntax structure containingan integer number of bytes that is encapsulated within a NAL unit. Insome instances, an RBSP includes zero bits.

Different types of NAL units may encapsulate different types of RBSPs.For example, a first type of NAL unit may encapsulate an RBSP for a PPS,a second type of NAL unit may encapsulate an RBSP for a coded slice, athird type of NAL unit may encapsulate an RBSP for SEI messages, and soon. NAL units that encapsulate RBSPs for video coding data (as opposedto RBSPs for parameter sets and SEI messages) may be referred to as VCLNAL units.

Video decoder 30 may receive a bitstream generated by video encoder 20.In addition, video decoder 30 may parse the bitstream to obtain syntaxelements from the bitstream. Video decoder 30 may reconstruct thepictures of the video data based at least in part on the syntax elementsobtained from the bitstream. The process to reconstruct the video datamay be generally reciprocal to the process performed by video encoder20. In addition, video decoder 30 may inverse quantize coefficientblocks associated with TUs of a current CU. Video decoder 30 may performinverse transforms on the coefficient blocks to reconstruct transformblocks associated with the TUs of the current CU. Video decoder 30 mayreconstruct the coding blocks of the current CU by adding the samples ofthe predictive blocks for PUs of the current CU to corresponding samplesof the transform blocks of the TUs of the current CU. By reconstructingthe coding blocks for each CU of a picture, video decoder 30 mayreconstruct the picture.

SAO coding has been included in the base HEVC standard. In general, theaddition of offset values to pixels in a video frame may improve thequality of reconstructed video quality without greatly increasing thebit overhead needed to store or transmit encoded video data. SAOtechniques allow for different offset values to be applied to differentpixels (or blocks) depending on pixel (or block) classification metrics.Possible classification metrics include band metrics and activitymetrics such as edge metrics. As SAO is implemented in the HEVCstandard, each LCU can have one of three SAO types, which may also bereferred to as pixel classifications. The three SAO types are no offset,band-type SAO, and edge-type SAO.

FIGS. 2A-2D are conceptual diagrams showing the four edge offsetclassifications included in HEVC. The edge offset type classifies eachpixel based on edge information. For each of the edge classificationsshown in FIGS. 2A-2D, an edge type for the current pixel is calculatedby comparing the value of the current pixel (C) to the values ofneighboring pixels (1 and 2). For SAO edge offset of classification zero(SAO_EO_0) shown in FIG. 2A, the current pixel (pixel C) is compared tothe left neighbor pixel (pixel 1) and the right neighbor pixel (pixel1). For SAO edge offset of classification one (SAO_EO_1) shown in FIG.2B, the current pixel (pixel C) is compared to the top neighbor pixel(pixel 1) and the bottom neighbor pixel (pixel 2). For SAO edge offsetof classification two (SAO_EO_2) shown in FIG. 2C, the current pixel(pixel C) is compared to the upper left neighbor pixel (pixel 1) and thebottom right neighbor pixel (pixel 2). For SAO edge offset ofclassification three (SAO_EO_3) shown in FIG. 2D, the current pixel(pixel C) is compared to the upper right neighbor pixel (pixel 1) andthe bottom left neighbor pixel (pixel 2).

The four edge offset classifications can each have an edge type with 5possible integer values ranging from −2 to 2. Initially, the edge typeof the current pixel is assumed to be zero. If the value of currentpixel C is equal to values of both the first neighbor pixel (pixel 1)and the second neighbor pixel (pixel 2), the edge type remains at zero.If the value of the current pixel C is greater than the value ofneighbor pixel 1, the edge type is increased by one. If the value of thecurrent pixel C is less than the value of neighbor pixel 1, the edgetype is decreased by one. Likewise, if the value of the current pixel Cis less than the value of neighbor pixel 2, the edge type is increasedby one, and if the value of the current pixel C is less than the valueof the neighbor pixel 2, the edge type is decreased by 1.

As such, the current pixel C may have an edge type of −2, −1, 0, 1, or2. The edge type is −2 if the value of current pixel C is less than bothvalues of neighbor pixels 1 and 2. The edge type is −1 if the value ofcurrent pixel C is less than one neighbor pixel, but equal to the otherneighbor pixel. The edge type is 0 if the value of current pixel C isthe same as both neighbor pixels, or if the value of current pixel C isgreater than one neighbor pixel, but less than the other neighbor pixel.The edge type is 1 if the value of the current pixel C is greater thanone neighbor pixel, but equal to the other neighbor pixel. The edge typeis 2 if the value of the current pixel C is greater than both values ofneighbor pixels 1 and 2. For each non-zero edge type value, four offsetvalues are determined and signaled in the encoded video bitstream foruse by a decoder (i.e., eoffset⁻², eoffset⁻¹, eoffset₁, eoffset₂).

In view of the above description, for each edge offset classification,edge type values may be computed for a pixel according to the followingpseudocode:

  EdgeType = 0; if (C > Pixel 1) EdgeType = EdgeType + 1; if (C <Pixel 1) EdgeType = EdgeType − 1; if (C > Pixel 2) EdgeType = EdgeType +1; if (C < Pixel 2) EdgeType = EdgeType − 1;

If video decoder 30 determines that a pixel has an edge type of −2, thenvideo decoder 30 adds the offset value eoffset⁻² to the pixel. If videodecoder 30 determines that a pixel has an edge type of −1, then videodecoder 30 adds the offset value eoffset⁻¹ to the pixel. If videodecoder 30 determines that a pixel has an edge type of 1, then videodecoder 30 adds the offset value eoffset₁ to the pixel. If video decoder30 determines that a pixel has an edge type of 2, then video decoder 30adds the offset value eoffset₂ to the pixel.

FIG. 3 is a conceptual diagram showing example bands that may be used inband-based SAO classification. Each rectangle in FIG. 3 represents aband. The example of FIG. 3 shows 32 bands, i.e., bands 0-31. Some ofthe bands, such as band 0, band 8, band 24, and band 31 have beenlabeled. In some implementations, more or fewer bands may be used. Forband-based offset, pixels are classified into different bands based onpixel values, such as intensity values. For purposes of example, assumepixel values range from 0-255 (e.g. 8-bit bitdepth), although otherranges such as 0-1023 (e.g. 10-bit bitdepth) may also be used. In suchan example, the maximum value shown in FIG. 3 would be equal to 255, andeach of the thirty-two bands shown in FIG. 3 would have a range of 8.The left-most band (i.e. band 0 in FIG. 3) would be pixel values 0-7,the next band (i.e. band 1 in FIG. 3) would be for pixel values of 8-15,the next band (i.e. band 2) would be for pixel values 16-23, and so on,until the right most band (i.e. band 31 in FIG. 3) which would be forpixel values 248-255. For band offset, pixels are classified intodifferent bands based on a pixel value such as an intensity value.Separate classifications may be used for luma and chroma. Based on whichband a pixel value falls in, an offset is added to the pixel. Forexample, if a pixel has a value of 19, then according to this currentexample, the pixel value falls within band 2 which ranges from pixelvalue 16 to 23. Thus, video decoder 30 would apply an offset associatedwith band 2 to the pixel value of 19.

For purposes of signaling the offset values associated with each of thebands, video encoder 20 may group the bands into two or more groups. Thetwo groups may, for example, be a first group of bands with signaledoffset values (e.g. bands 8-11 in the example of FIG. 3) and a secondgroup of bands with non-signaled offset values. The signaled offsetvalues may be either zero or non-zero values, while video decoder 30infers all the non-signaled values to be zero. For the first group ofbands with signaled offset values, video encoder 20 may signal to videodecoder 30 offset values (i.e., boffset₀, boffset₁, boffset₂, boffset₃,)as well as an indication of the first band with a signaled offset value.For the first band with a signaled offset value and the next three bandsin sequential order following the first band, video encoder 20 signalsoffset value to video decoder 30. For the remaining bands, video decoder30 may infer without signaling that the bands have an offset value ofzero.

For each LCU, video encoder 20 may perform multiple coding passes usingband-type SAO, edge-type SAO (e.g. SAO_EO_0, SAO_EO_1, SAO_EO_2,SAO_EO_3), and without using SAO. For band-type SAO, video encoder 20performs multiple coding passes using different groupings of bands aswell as different values for each band (e.g. different values forboffset₀, boffset₁, boffset₂, boffset₃,), and for each edge-type SAO,video encoder 20 also performs multiple coding passes using differentoffset values (e.g. different values for eoffset⁻², eoffset⁻¹, eoffset₁,eoffset₂). Performing this large number of coding passes for every LCUcan be computationally intensive. This disclosure introduces techniquesfor low complexity SAO encoding which may reduce the complexityassociated with determining SAO information for an LCU.

This disclosure includes technique that may reduce the complexity ofeach offset derivation. According to an example technique, video encoder20 may only check a subset of offset types, rather than all offsettypes. In other words, video encoder 20 may only perform coding passesto evaluation a subset of the offset types, rather than all offsettypes. As discussed above, in SAO as implemented in HEVC, there are fiveoffset types (1 band offset and 4 edge offset types including vertical,horizontal, 45 degree, and 135 degree). Video encoder 20 may also encodeSAO information using merge mode from left or upper LCUs, which includescopying SAO information from one of those LCUs.

According to the techniques of this disclosure, video encoder 20 may beconfigured to encode video data in multiple modes including, forexample, a fast coding mode and a high compression mode. The highcompression mode may provide better compression at a comparabledistortion level compared to the fast coding mode, but the highcompression mode may also take longer to encode the video data than thefast coding mode. The fast coding mode may sacrifice a certain amount ofcompression quality in order to encode the video data more quickly. Inthe fast encoding mode, video encoder 20 may only check, e.g., performcoding passes for, a subset of the SAO types, i.e., less than all SAOtypes, while in the high compression mode, video encoder 20 may performcoding passes for all of the SAO types. In general, the term subset, asused herein, will refer to a number of SAO types that is less than atotal number of all SAO types. As one example, in the fast encodingmode, video encoder 20 may only perform coding passes for band-typeoffset, horizontal edge offset, and vertical edge offset, while in thehigh compression coding mode, video encoder 20 may perform coding passesfor all five SAO types, i.e., band-type SAO and the four edge-type SAOtypes.

In some examples, video encoder 20 may check (e.g. perform coding passesfor) all five SAO types for some blocks and only check a subset of thefive SAO types (i.e., less than all five of the SAO types, such as onlyone, two, three or four SAO types) for other blocks. In some examples,video encoder 20 may check all five SAO types for one block, and thenuse the determined SAO type for that block to determine a subset of SAOtypes to check for neighboring blocks. That is, the members of thesubset of SAO types for which coding passes are performed forneighboring blocks may be selected based on the particular SAO typedetermined for the block.

According to one example, video encoder 20 may be configured to checkonly a subset of SAO types (i.e., 2 luma edge offset types such asvertical and horizontal) and/or only check SAO types for luma. By usingthese techniques, as much as 70% of the complexity associated withdetermining SAO information by an encoder may be saved.

The various techniques described in this disclosure may be applieddifferently for each slice or picture. As one example, for one slice orpicture, video encoder 20 may determine SAO type by checking all fiveSAO types for each LCU, while for other slices or pictures video encoder20 may only check a subset of the SAO types. In one example, videoencoder 20 may determine whether to check all SAO types or a subset ofthe SAO types based on a slice type or picture type. For example, for arandom access picture, video encoder 20 may check all SAO types, but forone or more other pictures only check a subset of SAO types. As anotherexample, for non-reference pictures, video encoder 20 may check only asubset of SAO types, but for reference pictures, video encoder 20 maycheck all (or a larger subset of) SAO types. Hence, the set of SAO typeschecked for non-reference pictures may be smaller than the set of SAOtypes checked for reference pictures. As yet another example, videoencoder 20 may determine whether to check all SAO types or a subset ofSAO types based on whether a frame, i.e., picture, is an I-picture,P-picture, or B-picture. Hence, the sets of SAO types checked forI-pictures, P-pictures and B-pictures may be different, e.g., larger orsmaller, for one another, and determined based on picture type. In oneexample, the sets of SAO types for P-pictures and B-pictures may be thesame, but different for I-pictures. In another example, the sets of SAOtypes may be different for each of the I-pictures, P-pictures andB-pictures. In another example, the sets of SAO types may be the samefor the I-pictures and P-pictures, but different for B-pictures. Inanother example, the sets of SAO types may be the same for theI-pictures and B-pictures but different for the P-pictures.

According to another technique of this disclosure, video encoder 20 maybe configured to use a subset of pixels within an LCU to derive offsets.Typically, a video encoder 20 uses all pixels within an LCU to deriveoffset values, but according to techniques of this disclosure, videoencoder 20 may use only partial pixels within an LCU. As one example,video encoder 20 may select a subset of pixels that does not include anyboundary pixels and use that subset of pixels to derive offset values.In order to make offset derivations compatible with common softwareacceleration schemes (e.g., ARM NEON, DSP special instructions, PC SSE),this disclosure also proposes making the subset a multiple of 8 pixels(e.g. 8, 16, 24, 32, 40). Most software acceleration schemes areconfigured to handle eight pixels at a time; so using multiples of 8 maylead to improved performance.

According to another technique of this disclosure, video encoder 20 maybe configured to use pre-deblocked pixels for offset derivation.Typically, video encoders are configured to use post-deblocked pixels toderive offsets. Referring to FIG. 4A, and example of a pre-deblockedimage would be the reconstructed image output from summer 62 beforebeing deblock filtered by deblock filtering 72. An example of apost-deblocked image would be the an image output from deblock filtering72 after being deblock filtered. To perform de-blocking on a lowerboundary of a block and a right boundary of a block, however, videoencoder 20 needs to have determined how to encoded the right neighboringblock and the below neighboring block. According to the techniques ofthis disclosure, video encoder 20 may determine which SAO information touse for a block by analyzing only pre-deblocked pixels for the block, orby analyzing deblocked pixels for the upper and left borders of theblock but only pre-deblocked pixels (e.g. pixels that have be deblockfiltered) for the right and lower boundaries of the block. Configuringvideo encoder 20 derive offset values using pre-deblocked pixels mayimprove dependency issues within hardware pipeline structures.

According to another technique of this disclosure, for band-type SAO,video encoder 20 may perform simplified band offset center derivation.Typically, when deciding a center of band offset, a video encoderperforms full RD analysis for all possible center values (i.e., 32positions). According to the techniques of this disclosure, videoencoder 20 may use a histogram to derive band offset center (i.e.,histogram center). Video encoder 20 may also determine band offsetvalue(s) for a subset of bands out of the four adjacent bands, dependingon histogram shape, for example, peakedness (kurtosis).

This disclosure also introduces techniques for reducing the number ofoffset derivations, i.e., reducing the number of different values thatare tested for boffset₀₋₃ and eoffset⁻²⁻². Video encoder 20 may beconfigured to reduce the number of offset derivations needed todetermine SAO information by using the one or more simplifications.

According to one example, video encoder 20 may be configured to performthreshold-based regular offset early termination. In SAO, a videoencoder typically derives offsets for a current LCU and compares thederived offsets with SAO merge (left/up merge) costs and chooses theoffset information (i.e. either derived or merge) that provides the moredesirable RD tradeoff. In many cases, however, merge modes (e.g. usingthe same SAO information as a neighboring block) frequently produce abetter RD tradeoff than deriving new SAO information. In many instances,a determination of whether or not to use the offset information of aneighboring block may be able to be made without comparing the RDtradeoff of the neighboring SAO information to that of newly derived SAOinformation. According to the techniques of this disclosure, videoencoder 20 may be trained with a threshold for early merge termination.The threshold may, for example, be based on how much the SAO informationof the neighboring blocks improves the quality of decoded video data orhow closely the decoded video resembles the original video. If theneighboring block's SAO information exceeds that threshold, then videoencoder 20 may skip checking derived SAO offset information, andinstead, use SAO merge mode, i.e., where SAO information from a left ortop neighbor LCU is used for the current LCU. The threshold training maybe performed using previous frame's statistics about merge costs andregular offset costs. In this context, cost may refer to an amount ofrate increase needed to achieve a certain reduction in distortion.

According to techniques of this disclosure, video encoder 20 may also beconfigured to perform threshold based merge early termination. Ifcurrent costs corresponding to regular offset are already good enough,video encoder 20 may skip merge computation. This threshold training maybe done by using one or more previous frames' statistics about mergecosts and regular offset costs.

According to another technique of this disclosure, video encoder 20 maybe configured to perform forced merges for every M LCUs, where M is apredetermined number of LCU's. Video encoder 20 may be configured to usemerge mode for every M LCUs so that video encoder 20 does not need toderive new offsets for every one of the LCUs (i.e., force to use mergefor every other LCUs).

FIG. 4A is a block diagram illustrating an example video encoder 20 thatmay implement the techniques described in this disclosure. Inparticular, video encoder 20 may implement the techniques of thisdisclosure to determine SAO information for a block of video data, andvideo encoder 20 may include, in an encoded bitstream, syntaxinformation indicative of the determined SAO information.

Video encoder 20 may perform intra- and inter-coding of video blockswithin video slices. Intra-coding relies on spatial prediction to reduceor remove spatial redundancy in video within a given video frame orpicture. Inter-coding relies on temporal prediction to reduce or removetemporal redundancy in video within adjacent frames or pictures of avideo sequence. Intra-mode (I mode) may refer to any of several spatialbased compression modes. Inter-modes, such as uni-directional prediction(P mode) or bi-prediction (B mode), may refer to any of severaltemporal-based compression modes.

In the example of FIG. 4A, video encoder 20 includes a partitioning unit35, prediction processing unit 41, summer 50, transform processing unit52, quantization unit 54, entropy encoding unit 56, and decoded picturebuffer (DPB) 78. Prediction processing unit 41 includes motionestimation unit 42, motion compensation unit 44, and intra predictionprocessing unit 46. For video block reconstruction, video encoder 20also includes inverse quantization unit 58, inverse transform processingunit 60, summer 62, deblocking filter 72, and SAO unit 74. Althoughdeblocking filter 72, and SAO unit 74 are shown in FIG. 4A as being inloop filters, in other configurations, deblocking filter 72 and SAO unit74 may be implemented as post loop filters.

As shown in FIG. 4A, video encoder 20 receives video data and stores thereceived video data in video data memory 33. Video data memory 33 maystore video data to be encoded by the components of video encoder 20.The video data stored in video data memory 33 may be obtained, forexample, from video source 18. DPB 78 may be a reference picture memorythat stores reference video data for use in encoding video data by videoencoder 20, e.g., in intra- or inter-coding modes. Video data memory 33and DPB 78 may be formed by any of a variety of memory devices, such asdynamic random access memory (DRAM), including synchronous DRAM (SDRAM),magnetoresistive RAM (MRAM), resistive RAM (RRAM), or other types ofmemory devices. Video data memory 33 and DPB 78 may be provided by thesame memory device or separate memory devices. In various examples,video data memory 33 may be on-chip with other components of videoencoder 20, or off-chip relative to those components.

Partitioning unit 35 retrieves the video data from video data memory 33and partitions the data into video blocks, e.g., as part of aninter/intra coding mode selection process. This partitioning may alsoinclude partitioning into slices, tiles, or other larger units, as wellsas video block partitioning, e.g., according to a quadtree structure ofLCUs and CUs. Video encoder 20 generally illustrates the components thatencode video blocks within a video slice to be encoded. The slice may bedivided into multiple video blocks (and possibly into sets of videoblocks referred to as tiles). Prediction processing unit 41 may selectone of a plurality of possible coding modes, such as one of a pluralityof intra coding modes or one of a plurality of inter coding modes, forthe current video block based on error results (e.g., coding rate andthe level of distortion). Prediction processing unit 41 may provide theresulting intra- or inter-coded block to summer 50 to generate residualblock data and to summer 62 to reconstruct the encoded block for use asa reference picture.

Intra prediction processing unit 46 within prediction processing unit 41may perform intra-predictive coding of the current video block relativeto one or more neighboring blocks in the same frame or slice as thecurrent block to be coded to provide spatial compression. Motionestimation unit 42 and motion compensation unit 44 within predictionprocessing unit 41 perform inter-predictive coding of the current videoblock relative to one or more predictive blocks in one or more referencepictures to provide temporal compression.

Motion estimation unit 42 may be configured to determine theinter-prediction mode for a video slice according to a predeterminedpattern for a video sequence. The predetermined pattern may designatevideo slices in the sequence as P slices or B. Motion estimation unit 42and motion compensation unit 44 may be highly integrated, but areillustrated separately for conceptual purposes. Motion estimation,performed by motion estimation unit 42, is the process of generatingmotion vectors, which estimate motion for video blocks. A motion vector,for example, may indicate the displacement of a PU of a video blockwithin a current video frame or picture relative to a predictive blockwithin a reference picture.

A predictive block is a block that is found to closely match the PU ofthe video block to be coded in terms of pixel difference, which may bedetermined by sum of absolute difference (SAD), sum of square difference(SSD), or other difference metrics. In some examples, video encoder 20may calculate values for sub-integer pixel positions of referencepictures stored in DPB 78. For example, video encoder 20 may interpolatevalues of one-quarter pixel positions, one-eighth pixel positions, orother fractional pixel positions of the reference picture. Therefore,motion estimation unit 42 may perform a motion search relative to thefull pixel positions and fractional pixel positions and output a motionvector with fractional pixel precision.

Motion estimation unit 42 calculates a motion vector for a PU of a videoblock in an inter-coded slice by comparing the position of the PU to theposition of a predictive block of a reference picture. The referencepicture may be selected from a first reference picture list (List 0) ora second reference picture list (List 1), each of which identify one ormore reference pictures stored in 78. Motion estimation unit 42 sendsthe calculated motion vector to entropy encoding unit 56 and motioncompensation unit 44.

Motion compensation, performed by motion compensation unit 44, mayinvolve fetching or generating the predictive block based on the motionvector determined by motion estimation, possibly performinginterpolations to sub-pixel precision. Upon receiving the motion vectorfor the PU of the current video block, motion compensation unit 44 maylocate the predictive block to which the motion vector points in one ofthe reference picture lists. Video encoder 20 forms a residual videoblock by subtracting pixel values of the predictive block from the pixelvalues of the current video block being coded, forming pixel differencevalues. The pixel difference values form residual data for the block,and may include both luma and chroma difference components. Summer 50represents the component or components that perform this subtractionoperation. Motion compensation unit 44 may also generate syntax elementsassociated with the video blocks and the video slice for use by videodecoder 30 in decoding the video blocks of the video slice.

Intra prediction processing unit 46 may intra predict a current block,as an alternative to the inter-prediction performed by motion estimationunit 42 and motion compensation unit 44, as described above. Inparticular, intra prediction processing unit 46 may determine anintra-prediction mode to use to encode a current block. In someexamples, intra prediction processing unit 46 may encode a current blockusing various intra-prediction modes, e.g., during separate encodingpasses, and intra prediction processing unit 46 may select anappropriate intra-prediction mode to use from the tested modes. Forexample, intra prediction processing unit 46 may calculate RD valuesusing an RD analysis for the various tested intra-prediction modes, andselect the intra-prediction mode having the best, or a desirable, RDcharacteristics among the tested modes. RD analysis generally determinesan amount of distortion (or error) between an encoded block and anoriginal, unencoded block that was encoded to produce the encoded block,as well as a bit rate (that is, a number of bits) used to produce theencoded block. Intra prediction processing unit 46 may calculate ratiosfrom the distortions and rates for the various encoded blocks todetermine which intra-prediction mode exhibits the best, or a desirable,RD value for the block.

In any case, after selecting an intra-prediction mode for a block, intraprediction processing unit 46 may provide information indicative of theselected intra-prediction mode for the block to entropy encoding unit56. Entropy encoding unit 56 may encode the information indicating theselected intra-prediction mode in accordance with the techniques of thisdisclosure. Video encoder 20 may include in the transmitted bitstreamconfiguration data, which may include a plurality of intra-predictionmode index tables and a plurality of modified intra-prediction modeindex tables (also referred to as codeword mapping tables), definitionsof encoding contexts for various blocks, and indications of a mostprobable intra-prediction mode, an intra-prediction mode index table,and a modified intra-prediction mode index table to use for each of thecontexts.

After prediction processing unit 41 generates the predictive block forthe current video block via either inter-prediction or intra-prediction,video encoder 20 forms a residual video block by subtracting thepredictive block from the current video block. The residual video datain the residual block may be included in one or more TUs and applied totransform processing unit 52. Transform processing unit 52 transformsthe residual video data into residual transform coefficients using atransform, such as a discrete cosine transform (DCT) or a conceptuallysimilar transform. Transform processing unit 52 may convert the residualvideo data from a pixel domain to a transform domain, such as afrequency domain.

Transform processing unit 52 may send the resulting transformcoefficients to quantization unit 54. Quantization unit 54 quantizes thetransform coefficients to further reduce bit rate. The quantizationprocess may reduce the bit depth associated with some or all of thecoefficients. The degree of quantization may be modified by adjusting aquantization parameter. In some examples, quantization unit 54 may thenperform a scan of the matrix including the quantized transformcoefficients. Alternatively, entropy encoding unit 56 may perform thescan.

Following quantization, entropy encoding unit 56 entropy encodes thequantized transform coefficients. For example, entropy encoding unit 56may perform context adaptive variable length coding (CAVLC), contextadaptive binary arithmetic coding (CABAC), syntax-based context-adaptivebinary arithmetic coding (SBAC), probability interval partitioningentropy (PIPE) coding or another entropy encoding methodology ortechnique. Following the entropy encoding by entropy encoding unit 56,the encoded bitstream may be transmitted to video decoder 30, orarchived for later transmission or retrieval by video decoder 30.Entropy encoding unit 56 may also entropy encode the motion vectors andthe other syntax elements for the current video slice being coded.

Inverse quantization unit 58 and inverse transform processing unit 60apply inverse quantization and inverse transformation, respectively, toreconstruct the residual block in the pixel domain for later use as areference block of a reference picture. Motion compensation unit 44 maycalculate a reference block by adding the residual block to a predictiveblock of one of the reference pictures within one of the referencepicture lists. Motion compensation unit 44 may also apply one or moreinterpolation filters to the reconstructed residual block to calculatesub-integer pixel values for use in motion estimation. Summer 62 addsthe reconstructed residual block to the motion compensated predictionblock produced by motion compensation unit 44 to produce a referenceblock for storage in DPB 78. The reference block may be used by motionestimation unit 42 and motion compensation unit 44 as a reference blockto inter-predict a block in a subsequent video frame or picture.

Prior to storage in DPB 78, the reconstructed residual block can befiltered by one or more filters. If desired, deblocking filter 72 mayalso be applied to filter the reconstructed residual blocks in order toremove blockiness artifacts. Other loop filters, such as an adaptiveloop filter (either in the coding loop or after the coding loop) mayalso be used to smooth pixel transitions, or otherwise improve the videoquality. The reference block, after being filtered by one or more ofdeblocking filter 72 and SAO unit 74 may be used by motion estimationunit 42 and motion compensation unit 44 as a reference block tointer-predict a block in a subsequent video frame or picture.

SAO unit 74 can determine offset values for SAO filtering in a mannerthat improves video coding quality. Improving video coding quality may,for example, involve determining offset values that make a reconstructedimage more closely match an original image. Video encoder 20 may, forexample, code the video data using multiple passes with different SAOtypes and different offset values and choose, for inclusion in anencoded bitstream, the SAO type and offset values that offer the bestcoding quality, as determined based on a desired RD tradeoff.

In some configurations, SAO unit 74 may be configured to apply two typesof offset (e.g., band offset and edge offset) as described above. SAOunit 74 may also at times apply no offset, which can itself beconsidered a third type of offset. The type of offset applied by SAOunit 74 may be either explicitly or implicitly signaled to a videodecoder. When applying edge offset, pixels can be classified based onedge information in accordance with FIGS. 2A-2D and an offset value canbe determined based on the edge classification. When applying band-basedoffset, SAO unit 74 can classify pixels into different bands based on apixel value, such as an intensity value, with each band having anassociated offset.

FIG. 4B is a block diagram illustrating an alternative view of anexample video encoder 21 that may implement the techniques described inthis disclosure. FIG. 4B represents a typical HEVC video encoder. Videoencoder 21 includes general coder control unit 140, motion estimationunit 142, motion compensation unit 144, intra-picture estimation unit145, intra-picture prediction processing unit 146, transform scaling andquantization unit 152/154, scaling and inverse transform unit 158/160,filter control analysis unit 170, deblocking and SAO filters 172/174,decoded picture buffer 178, and header formatting and CABAC unit 180.Each of these components generally performs the same functions as itslike numbered equivalent in FIG. 4A. For example, motion estimation unit142 generally performs the same functionality as motion estimation unit42 in FIG. 4A, and transform scaling and quantization unit 152/154generally performs the same functionality as transform processing unit52 and quantization unit 54.

General coder control unit 140 selects and maintains various parametersfor how video encoder 21 is to encode video data. For example, generalcoder control unit 140 may select the profiles, tiers, and levels of theHEVC standard to which the video data is to be coded in accordance with.General coder control unit 140 may also, for example, establish andmaintain the bitrate and desired RD levels.

Video encoder 21 partitions an input video signal into video blocks(e.g. CTUs) and sends those CTUs to motion estimation unit 142 andintra-picture estimation unit 145. Motion estimation unit 142 may beconfigured to determine an inter-prediction mode for a block of videoaccording to a predetermined pattern for a video sequence. Intra-pictureestimation unit 145 may be configured to determine an intra predictionmode for the block of video data. Video encoder 21 selects one of theintra prediction mode or the inter prediction mode for coding the blockof video data. The selected intra prediction data or motion data is sentto header formatting and CABAC unit 180, which may entropy encode thedata for inclusion in the encoded bitstream.

At summer 150, video encoder 21 determines residual data by subtractinga predicted block, identified using the determined motion data or intraprediction data, from an original block. Transform, scaling, andquantization unit 152/154 transforms the residual video data intoresidual transform coefficients using a transform, such as a DCT or aconceptually similar transform and may convert the residual video datafrom a pixel domain to a transform domain, such as a frequency domain.Transform, scaling, and quantization unit 152/154 also quantizes thetransform coefficients to further compress the data. The quantizationprocess may reduce the bit depth associated with some or all of thecoefficients. Transform, scaling, and quantization unit 152/154 sendsthe quantized transform coefficients to header formatting and CABAC unit180, which may entropy encode the quantized transform coefficients forinclusion in the encoded bitstream.

Video encoder 21 may also include a decoding loop for determining thequality of video encoding achieved for various encoding hypotheses. Inthe decoding loop, scaling and inverse transform unit 158/160 applyinverse quantization and inverse transformation to reconstruct theresidual block in the pixel domain. Summer 162 adds the reconstructedresidual block to the predicted block found by either intra-pictureprediction processing unit 146 of motion compensation unit 144 todetermine a reconstructed block.

Filter control analysis unit 170 determines the filter information,including any SAO information, to be used for filtering thereconstructed blocks. Filter control analysis unit 170 sends thedetermined filter information to header formatting and CABAC unit 180,which may entropy encode the filter information for inclusion in theencoded bitstream. Deblocking and SAO filters 172/174 may also apply oneor more filters, based on the filter information determined by filtercontrol analysis unit 170, to the reconstructed block in order to removeblockiness artifacts and otherwise improve the video quality. As part ofperforming multiple coding passes, filter control analysis unit 170 mayderive multiple different sets of filter information, and deblocking andSAO filters 172/174 may filter reconstructed blocks using the derivedfilter information as part of determining which filter information ofthe different sets of filter information to use for coding the blocks.

Prior to storage in DPB 178, deblocking and SAO filters 172/174 mayfilter the reconstructed block using the determined filter information.Thus, when coding future blocks of video data, intra-picture estimationunit 145 and motion estimation unit 142 may search for predictive blocksin the filtered, reconstructed blocks, which are the same blocks a videodecoder uses for locating predictive blocks.

In a typical HEVC encoder, the video encoder must implement several newcoding tools in order to generate an HEVC compliant bitstream. Amongthose new coding tools is SAO which may visually and objectively bringlarge coding gains in some coding scenarios. Designing a good SAOparameter encoding engine with reasonable complexity is an importantchallenge.

In accordance with the techniques introduced above, video encoder 20 andvideo encoder 21 represent examples of video encoders configured toencode video data according to a video coding standard that supports aset of SAO types. In this disclosure, video encoder 20/21 is intended torepresent either of video encoder 20 or video encoder 21 individually orto represent a video encoder that incorporates features of both videoencoder 20 and video encoder 21. Unless stated to contrary, thefunctions and features of video encoder 20 and video encoder 21 are notmutually exclusive. Moreover, the techniques of this disclosure are notlimited to any particular type of video encoder. Video encoder 20 andvideo encoder 21 are two examples of video encoders that may perform thetechniques of this disclosure, but video encoder 20 and video encoder 21are not the only implementations of video encoders that may perform thetechniques described herein.

In one example, for a block of pixel data, video encoder 20/21 performsa plurality of coding passes to test a subset of the SAO types with thesubset being smaller than the set. Video encoder 20/21 selects from thesubset of SAO types, an SAO type to encode the video data and encodesthe video data according to the selected SAO type. In some examples, theset of SAO types includes a band offset type, a first edge offset type,a second edge offset type, a third edge offset type, and a fourth edgeoffset type.

In some examples, video encoder 20/21 codes the video data in a firstcoding mode that involves performing the plurality of coding passes totest the subset of the SAO types and coding the video data in a secondcoding mode that includes performing a plurality of coding passes totest all SAO types of the set of SAO types. For a first block of pixeldata, video encoder 20/21 may perform a plurality of coding passes totest the set of SAO types, and for the first block of pixel data, videoencoder 20/21 may select an SAO type to encode the first block of pixeldata. For another block of pixel data, video encoder 20/21 may selectthe SAO types to include in the subset of the SAO types based on the SAOtype selected to encode the first block of pixel data.

Video encoder 20/21 may also be configured to, for a luma block of pixeldata, perform a plurality of coding passes to test one or more SAO typesfrom a set of SAO types and selecting from the one or more SAO types, anSAO type to encode the luma block of pixel data. Video encoder 20/21 mayalso encode a chroma block corresponding to the luma block using theselected SAO type. In other words, video encoder 20/21 may select a lumaSAO type and use the selected SAO type for chroma. In such an example,video encoder 20/21 may encode the chroma block using the selected SAOtype without testing SAO types for the chroma block or after onlytesting a subset of SAO types (e.g., only merge candidates).

Video encoder 20/21 may also be configured to, for a block of pixeldata, perform a plurality of coding passes to test coding of a subset ofthe pixels in the block using a plurality of SAO types and offsetvalues, and for each coding pass, compare the subset of pixels withadded offset values to corresponding pixels of an original block ofvideo data. Based on the comparison, video encoder 20/21 selects an SAOtype and associated offset values to encode the block. In some examples,the subset of pixels may include fewer than all pixels in the block ofdata and/or may exclude pixels on the boundary of the block. The subsetof pixels may be an integer multiple of 8 pixels.

Video encoder 20/21 may also be configured to encode blocks of a firstportion of video data using a set of SAO types and encode blocks of asecond portion of video data using only a subset of SAO types. Thesubset of SAO types includes fewer than all of the SAO types in the setof SAO types. The first portion of video data may, for example, be afirst slice of the video data, and the second portion of video data maybe a second slice of the video data. The first portion of video data maybe a first picture of the video data, and the second portion of videodata may be a second picture of the video data. In another example, thefirst portion of video data may be a reference picture, and the secondportion of video data may be a non-reference picture. In other examples,the first portion of video data may be a random access picture.

Video encoder 20/21 may also be configured to determine SAO informationfor a first block and add offset values to a second block using the SAOinformation of the first block. Video encoder 20/21 may compare thesecond block with the added offset values to a corresponding originalblock, and in response to a difference between the second block and theoriginal block being less than a threshold amount of difference, encodethe second block using the SAO information of the first block andterminating an SAO information derivation process. As part of encodingthe second block using the SAO information of the first block, videoencoder 20/21 comprises generating a merge flag. In response to thedifference between the second block and the original block being lessthan the threshold amount of difference, video encoder 20/21 mayterminate the SAO information derivation process prior to checking SAOinformation other than the SAO information of the first block. Videoencoder 20/21 may dynamically determine the threshold based on acomparison of one or more previously encoded blocks to one or morecorresponding original video blocks. The threshold may be based on adistortion between one or more previously encoded blocks and one or morecorresponding original video blocks. The difference between the secondblock and the original block being less than the threshold amount ofdifference may correspond to a distortion between the second block andthe original block being less than or equal to the distortion betweenthe one or more previously encoded blocks and the one or morecorresponding original video blocks.

Video encoder 20/21 may be configured to, for a block of pixel data,perform a plurality of coding passes to test a plurality of SAOinformation. The block may include pre-deblocked pixel data. Videoencoder 20/21 may select from the plurality of SAO information, SAOinformation for encoding the video data. The block of pixel data mayinclude pre-deblocked pixels on a right boundary of the block and/or ona bottom boundary of the block. In some examples, the block of pixeldata may also include post-deblocked pixels on a left boundary of theblock and/or on an upper boundary of the block.

Video encoder 20/21 may be configured to, for a block of pixels,determine a distribution of pixel values for the pixels in the block anddetermine a center band based on the distribution. Video encoder 20/21may perform a plurality of coding passes including band-type SAOencoding to check M bands adjacent to the determined center band. Aspart of determining the distribution, video encoder 20/21 may, forpixels in the block, identify bands associated with the pixels, and aspart of determining the center band, and video encoder 20/21 may, basedon the identifying, determine a most frequently occurring band. Videoencoder 20/21 may perform a plurality of coding passes includingband-type SAO encoding to check M blocks adjacent to the determinedcenter band and only check the M bands, where M is less than a totalnumber of bands.

Video encoder 20/21 may also be configured to encode a plurality ofblocks using an SAO encoding technique and track for the number ofblocks coded using an SAO merge mode. Based on the tracking, videoencoder 20/21 may determine whether to code a block of the plurality ofblocks using either the SAO merge mode or a non-merge mode such that anumber of times the SAO merge mode is selected exceeds a minimumthreshold. For example, video encoder 20/21 may control the number ofblocks using merge mode to code at least a minimum number of the blocksusing merge mode. Video encoder 20/21 may determine whether to encodethe plurality of blocks using either the SAO merge mode or the non-mergemode by selecting at least one out of every M blocks to be coded usingthe SAO merge mode, where M is an integer value. The SAO merge mode mayinclude one or both of a left-neighbor merge mode or an above-neighbormerge mode.

FIG. 5 is a block diagram illustrating an example video decoder 30 thatmay decode encoded video data according to the techniques described inthis disclosure. Although video decoder 30 is presented as a videodecoder configured to receive and decode video data, it should beunderstood that many of the techniques described with respect to videodecoder 30 may also be performed by video encoder 20 or 21. Videoencoder 20/21 may, for example, include a video decoding loop, and aspart of performing multiple coding passes, video encoder 20/21 mayencode video data and then decode the encoded video data in order toanalyze the quality of the encoding.

In the example of FIG. 5, video decoder 30 includes an entropy decodingunit 80, prediction processing unit 81, inverse quantization unit 86,inverse transform processing unit 88, summer 90, deblocking filter 93,SAO unit 94, and reference picture memory 92. Prediction processing unit81 includes motion compensation unit 82 and intra-prediction unit 84.Video decoder 30 may, in some examples, perform a decoding passgenerally reciprocal to the encoding pass described above with respectto video encoder 20 or 21 of FIGS. 4A and 4B.

During the decoding process, video decoder 30 receives an encoded videobitstream that represents video blocks of an encoded video slice andassociated syntax elements from video encoder 20. Entropy decoding unit80 of video decoder 30 entropy decodes the bitstream to generatequantized coefficients, motion vectors, and other syntax elements.Entropy decoding unit 80 forwards the motion vectors and other syntaxelements to prediction processing unit 81. Video decoder 30 may receivethe syntax elements at the video slice level and/or the video blocklevel.

When the video slice is coded as an intra-coded (I) slice,intra-prediction unit 84 of prediction processing unit 81 may generateprediction data for a video block of the current video slice based on asignaled intra prediction mode and data from previously decoded blocksof the current frame or picture. When the video frame is coded as aninter-coded (i.e., B or P) slice, motion compensation unit 82 ofprediction processing unit 81 produces predictive blocks for a videoblock of the current video slice based on the motion vectors and othersyntax elements received from entropy decoding unit 80. The predictiveblocks may be produced from one of the reference pictures within one ofthe reference picture lists. Video decoder 30 may construct thereference frame lists, List 0 and List 1, using default constructiontechniques based on reference pictures stored in reference picturememory 92.

Motion compensation unit 82 determines prediction information for avideo block of the current video slice by parsing the motion vectors andother syntax elements, and uses the prediction information to producethe predictive blocks for the current video block being decoded. Forexample, motion compensation unit 82 uses some of the received syntaxelements to determine an inter-prediction mode used to code the videoblocks of the video slice, an inter-prediction slice type (e.g., B sliceor P slice), construction information for one or more of the referencepicture lists for the slice, motion vectors for each inter-encoded videoblock of the slice, inter-prediction status for each inter-coded videoblock of the slice, and other information to decode the video blocks inthe current video slice.

Motion compensation unit 82 may also perform interpolation based oninterpolation filters. Motion compensation unit 82 may use interpolationfilters as used by video encoder 20 during encoding of the video blocksto calculate interpolated values for sub-integer pixels of referenceblocks. In this case, motion compensation unit 82 may determine theinterpolation filters used by video encoder 20 from the received syntaxelements and use the interpolation filters to produce predictive blocks.

Inverse quantization unit 86 inverse quantizes, i.e., de-quantizes, thequantized transform coefficients provided in the bitstream and decodedby entropy decoding unit 80. The inverse quantization process mayinclude use of a quantization parameter calculated and signaled by videoencoder 20. Video encoder 20 determines a quantization parameter foreach video block. Using signaled information from video encoder 20, aquantization parameter may be determined by video decoder 30 for eachvideo block in the video slice to determine a degree of quantizationand, likewise, a degree of inverse quantization that should be applied.Inverse transform processing unit 88 applies an inverse transform, e.g.,an inverse DCT, an inverse integer transform, or a conceptually similarinverse transform process, to the transform coefficients in order toproduce residual blocks in the pixel domain.

After motion compensation unit 82 generates the predictive block for thecurrent video block based on the motion vectors and other syntaxelements, video decoder 30 forms a decoded video block by summing theresidual blocks from inverse transform processing unit 88 with thecorresponding predictive blocks generated by motion compensation unit82. Summer 90 represents the component or components that perform thissummation operation. The decoded video blocks formed by summer 90 canthen be filtered by a deblocking filter 93, and SAO unit 94. The decodedvideo blocks in a given frame or picture are then stored in referencepicture memory 92, which stores reference pictures used for subsequentmotion compensation. Reference picture memory 92 also stores decodedvideo data for later presentation on a display device, such as displaydevice 32 of FIG. 1. SAO unit 94 can be configured to apply the samefiltering (e.g., edge offset and band offset) as SAO unit 74 discussedabove.

FIGS. 6-13 are flow diagrams illustrating technique for determining SAOinformation as part of a video encoding process. The techniques of FIGS.6-13 will be described with references to a generic video encoder. Thegeneric video encoder may incorporate features of video encoder 20and/or video encoder 21 or may be a different configuration of videoencoder. While the techniques of FIGS. 6-13 are shown separately forease of description, it should be understood that the various techniquesdescribed may be used in conjunction with one another, either partiallyor in full.

According to the techniques of FIG. 6, the video encoder encodes videodata according to a video coding standard that supports a set of SAOtypes (260). For a block of pixel data, the video encoder may perform aplurality of coding passes to test a subset of the SAO types (262). Thesubset of SAO types may be smaller, i.e., include fewer types, than theset, i.e., the full set, of SAO types. The video encoder selects fromthe subset of SAO types, an SAO type to encode the video data (264). Thevideo encoder encodes the video data according to the selected SAO type(266). To code the video data according to the selected SAO type may,the video encoder may, for example, include signaling (e.g. mergesignaling, difference signaling, or direct signaling) in the encodedbitstream so that a video decoder can identify the selected SAO type.Furthermore, as part of encoding the video data according to theselected SAO type, the video encoder may apply offset values to areconstructed block of video data according to the selected SAO type.The video encoder may compare this block with the added offset values toan original block as part of analyzing a coding pass, and the videoencoder may additionally store the block with the added offset values ina decoded picture buffer for use in predicting blocks of video in futureframes.

According to the techniques of FIG. 7, for a luma block of pixel data,the video encoder performs a plurality of coding passes to test one ormore SAO types from a set of SAO types (270). The video encoder selectsfrom the one or more SAO types, an SAO type to encode the luma block ofpixel data (272). The video encoder encodes a chroma block correspondingto the luma block using the selected SAO type (274). Thus, rather thanseparately determining an SAO type for luma and chroma samples, thevideo encoder may determine an SAO type for luma samples of a block by,for example, performing multiple coding passes, and then use that sameSAO type for encoding chroma samples of the block without performingmultiple coding passes or while performing a reduced number of codingpasses for encoding chroma samples.

According to the techniques of FIG. 8, for a block of pixel data, thevideo encoders performs a plurality of coding passes to test coding of asubset of the pixels in the block using a plurality of SAO types andoffset values (280). For each coding pass, the video encoder comparesthe subset of pixels with added offset values to corresponding pixels ofan original block of video data (282). Based on the comparison, thevideo encoder selects an SAO type and associated offset values to encodethe block (284). Thus, rather than performing coding passes anddetermining offset values for all pixels in a block (e.g. an LCU), thevideo encoder may reduce complexity by only determining offsets for asubset of the pixels and comparing only the subset to the original videodata.

According to the techniques of FIG. 9, the video encoder encodes blocksof a first portion of video data using a set of SAO types (290). Thevideo encoder encodes blocks of a second portion of video data usingonly a subset of SAO types (292). The subset of SAO types includes fewerthan all of the SAO types in the set of SAO types.

According to the techniques of FIG. 10, the video encoder determines SAOinformation for a first block (300). The video encoder adds offsetvalues to a second block using the SAO information of the first block(302). The video encoder compares the second block with the added offsetvalues to a corresponding original block (304). In response to adifference between the second block and the original block being lessthan a threshold amount of difference (306, YES), the video encoderencodes the second block using the SAO information of the first blockand terminates an SAO information derivation process (308). The videoencoder 20 may, for example, terminate the SAO information derivationprocess after only testing the SAO information of the first block (andpossibly other already coded blocks) without performing coding passes totest SAO information derived specifically for the second block. Inresponse to a difference between the second block and the original blocknot being less than a threshold amount of difference (306, NO), thevideo encoder performs additional coding passes to determine SAOinformation for the second block (310).

According to the techniques of FIG. 11, for a block of pixel data, thevideo encoder performs a plurality of coding passes to test a pluralityof SAO information (312). The block comprises pre-deblocked pixel data.The video encoder selects from the plurality of SAO information, SAOinformation for encoding the video data (314). By using pre-deblockedpixel data, either fully pre-deblocked or partially pre-deblocked, videoencoder hardware which may increase encoding speed by enabling greaterparallel processing. As deblock filtering only alters border pixels,determining SAO information using pre-deblocked pixel data may notdramatically alter the quality SAO filtering.

According to the techniques of FIG. 12, for a block of pixels, the videoencoder determines a distribution of pixel values for the pixels in theblock (320). The video encoder determines a center band based on thedistribution (322). The video encoder performs a plurality of codingpasses including band-type SAO encoding to check (e.g. perform codingpasses for) M bands adjacent to the determined center band (324). Inthis example, M is an integer value. The video encoder may compare thecost (e.g. the RD tradeoff) achieved with the center band and the Mbands adjacent to the center band to other types of SAO encoding (e.g.edge type SAO) to determine SAO information for a block. Thus, the videoencoder may determine SAO information without checking all the bandsavailable in band-type SAO encoding.

According to the techniques of FIG. 13, the video encoder encodes aplurality of blocks using an SAO encoding technique (330). The videoencoder tracks for the plurality of blocks a number of blocks codedusing an SAO merge mode (332). The video encoder determines whether tocode a block of the plurality of blocks using either the SAO merge modeor a non-merge mode such that a number of times the SAO merge mode isselected exceeds a minimum threshold (334). When coding the block in anSAO merge mode, the video encoder may, for example, generate forinclusion in an encoded bitstream of video data one or more merge flagsidentifying a neighboring block for which SAO information for the blockis to be copied. When coding the block in a non-merge mode, the videoencoder may signal new SAO information, including both an SAO type andSAO offset values.

In one or more examples, the functions described may be implemented inhardware, software, firmware, or any combination thereof. If implementedin software, the functions may be stored on or transmitted over, as oneor more instructions or code, a computer-readable medium and executed bya hardware-based processing unit. Computer-readable media may includecomputer-readable storage media, which corresponds to a tangible mediumsuch as data storage media, or communication media including any mediumthat facilitates transfer of a computer program from one place toanother, e.g., according to a communication protocol. In this manner,computer-readable media generally may correspond to (1) tangiblecomputer-readable storage media which is non-transitory or (2) acommunication medium such as a signal or carrier wave. Data storagemedia may be any available media that can be accessed by one or morecomputers or one or more processors to retrieve instructions, codeand/or data structures for implementation of the techniques described inthis disclosure. A computer program product may include acomputer-readable medium.

By way of example, and not limitation, such computer-readable storagemedia can comprise RAM, ROM, EEPROM, CD-ROM or other optical diskstorage, magnetic disk storage, or other magnetic storage devices, flashmemory, or any other medium that can be used to store desired programcode in the form of instructions or data structures and that can beaccessed by a computer. Also, any connection is properly termed acomputer-readable medium. For example, if instructions are transmittedfrom a website, server, or other remote source using a coaxial cable,fiber optic cable, twisted pair, digital subscriber line (DSL), orwireless technologies such as infrared, radio, and microwave, then thecoaxial cable, fiber optic cable, twisted pair, DSL, or wirelesstechnologies such as infrared, radio, and microwave are included in thedefinition of medium. It should be understood, however, thatcomputer-readable storage media and data storage media do not includeconnections, carrier waves, signals, or other transient media, but areinstead directed to non-transient, tangible storage media. Disk anddisc, as used herein, includes compact disc (CD), laser disc, opticaldisc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wheredisks usually reproduce data magnetically, while discs reproduce dataoptically with lasers. Combinations of the above should also be includedwithin the scope of computer-readable media.

Instructions may be executed by one or more processors, such as one ormore DSPs, general purpose microprocessors, application specificintegrated circuits ASICs, FPGAs, or other equivalent integrated ordiscrete logic circuitry. Accordingly, the term “processor,” as usedherein may refer to any of the foregoing structure or any otherstructure suitable for implementation of the techniques describedherein. In addition, in some aspects, the functionality described hereinmay be provided within dedicated hardware and/or software modulesconfigured for encoding and decoding, or incorporated in a combinedcodec. Also, the techniques could be fully implemented in one or morecircuits or logic elements.

The techniques of this disclosure may be implemented in a wide varietyof devices or apparatuses, including a wireless handset, an IC or a setof ICs (e.g., a chip set). Various components, modules, or units aredescribed in this disclosure to emphasize functional aspects of devicesconfigured to perform the disclosed techniques, but do not necessarilyrequire realization by different hardware units. Rather, as describedabove, various units may be combined in a codec hardware unit orprovided by a collection of interoperative hardware units, including oneor more processors as described above, in conjunction with suitablesoftware and/or firmware.

Various examples have been described. These and other examples arewithin the scope of the following claims.

1-20. (canceled)
 21. A method of encoding video data, the methodcomprising: encoding video data according to a plurality of sampleadaptive offset (SAO) types; performing a plurality of coding passes totest the plurality of SAO types for a subset of samples for a firstblock of video data, wherein the subset of samples comprises fewer thanall samples in the block; selecting from the plurality of SAO types anSAO type for the first block of video data; and generating for inclusionin an encoded bitstream, information for identifying the selected SAOtype for the first block.
 22. The method of claim 21, wherein theplurality of SAO types includes a band offset type, a first edge offsettype, a second edge offset type, a third edge offset type, and a fourthedge offset type.
 23. The method of claim 21, wherein a number ofsamples in the subset of samples for the first block of video data is amultiple of
 8. 24. The method of claim 21, wherein the first block ofvideo data comprises a pre-deblock filtered block of video data.
 25. Themethod of claim 21, wherein performing the plurality of coding passes totest the plurality of SAO types for the subset of samples for the firstblock of video data comprises performing the plurality of coding passesto test a subset of the SAO types, wherein the subset of the SAO typesincludes fewer SAO types than the plurality of SAO types.
 26. The methodof claim 21, wherein performing the plurality of coding passes to testthe plurality of SAO types for the subset of samples for the first blockof video data comprises performing the plurality of coding passes totest the plurality of SAO types for a luma block of the first block ofvideo data, and selecting the SAO type from the plurality of SAO typescomprises selecting the SAO type to encode the luma block of the firstblock of video data, the method further comprising: encoding a chromablock corresponding to the luma block using the selected SAO typewithout performing a coding pass to test any of the plurality of SAOtypes for the chroma block.
 27. The method of claim 21, furthercomprising: determining offset values for the first block of video data;adding the offset values to a second block of video data using the SAOtype selected for the first block of video data; comparing the secondblock of video data with the added offset values to a correspondingoriginal block; and in response to a difference between the second blockof video data and the corresponding original block of video data beingless than a threshold amount of difference, encoding the second block ofvideo data using the selected SAO type and the offset values determinedfor the first block and terminating an SAO information derivationprocess.
 28. The method of claim 27, wherein encoding the second blockusing the selected SAO type and the offset values determined for thefirst block comprises generating a merge flag.
 29. The method of claim27, wherein terminating the SAO information derivation process comprisesterminating the SAO information derivation process prior to checking SAOinformation other than the selected SAO type and the offset valuesdetermined for the first block.
 30. A device for encoding video data,the device comprising: a memory configured to store video data; and oneor more processors configured to: encode video data according to aplurality of sample adaptive offset (SAO) types; perform a plurality ofcoding passes to test the plurality of SAO types for a subset of samplesfor a first block of video data, wherein the subset of samples comprisesfewer than all samples in the block; select from the plurality of SAOtypes an SAO type for the first block of video data; and generate forinclusion in an encoded bitstream, information for identifying theselected SAO type for the first block.
 31. The device of claim 30,wherein the plurality of SAO types includes a band offset type, a firstedge offset type, a second edge offset type, a third edge offset type,and a fourth edge offset type.
 32. The device of claim 30, wherein anumber of samples in the subset of samples for the first block of videodata is a multiple of
 8. 33. The device of claim 30, wherein the firstblock of video data comprises a pre-deblock filtered block of videodata.
 34. The device of claim 30, wherein to perform the plurality ofcoding passes to test the plurality of SAO types for the subset ofsamples for the first block of video data, the one or more processorsare configured to perform the plurality of coding passes to test asubset of the SAO types, wherein the subset of the SAO types includesfewer SAO types than the plurality of SAO types.
 35. The device of claim30, wherein to perform the plurality of coding passes to test theplurality of SAO types for the subset of samples for the first block ofvideo data, the one or more processors are configured to perform theplurality of coding passes to test the plurality of SAO types for a lumablock of the first block of video data, and selecting the SAO type fromthe plurality of SAO types comprises selecting the SAO type to encodethe luma block of the first block of video data, wherein the one or moreprocessors are further configured to: encode a chroma blockcorresponding to the luma block using the selected SAO type withoutperforming a coding pass to test any of the plurality of SAO types forthe chroma block.
 36. The device of claim 30, wherein the one or moreprocessors are configured to: determine offset values for the firstblock of video data; add the offset values to a second block of videodata using the SAO type selected for the first block of video data;compare the second block of video data with the added offset values to acorresponding original block; and in response to a difference betweenthe second block of video data and the corresponding original block ofvideo data being less than a threshold amount of difference, encode thesecond block of video data using the selected SAO type and the offsetvalues determined for the first block and terminating an SAO informationderivation process.
 37. The device of claim 36, wherein to encode thesecond block using the selected SAO type and the offset valuesdetermined for the first block, the one or more processors areconfigured to generate a merge flag.
 38. The device of claim 36, whereinto terminate the SAO information derivation process, the one or moreprocessors are configured to terminate the SAO information derivationprocess prior to checking SAO information other than the selected SAOtype and the offset values determined for the first block.
 39. Thedevice of claim 30, wherein the device comprises a wirelesscommunication device, further comprising a transmitter configured totransmit encoded video data.
 40. The device of claim 39, wherein thewireless communication device comprises a telephone handset and whereinthe transmitter is configured to modulate, according to a wirelesscommunication standard, a signal comprising the encoded video data.